Fall back to fs::copy when hard_link fails.
authorCliff L. Biffle <code@cliffle.com>
Sun, 25 Sep 2016 20:53:07 +0000 (13:53 -0700)
committerCliff L. Biffle <code@cliffle.com>
Sun, 25 Sep 2016 20:57:26 +0000 (13:57 -0700)
commitcf5640aa7380fd5838a65c6567989dc9ecc9359d
tree86d219f17d2af5b788ba3773d168a9b81eb81e5e
parent67cd2d62fc7dc6908257898935d732e908ffd4ce
Fall back to fs::copy when hard_link fails.

Some filesystems don't allow hard links.  Since Cargo's use of hard
links is an optimization, and not necessary for correctness, it can fall
back to a file copy when hard linking is not available.

This is one possible solution to #3098.

Caveat: this will try to copy if the hard link fails *for any reason*.
It's not clear that there's a more surgical way of handling this; Unix
tends to indicate the condition as "permission denied," not with a
granular "links not supported by filesystem" error.
src/cargo/ops/cargo_rustc/mod.rs